from flask_script import Manager, Server, Command
from flask_migrate import Migrate, migrate, upgrade
from app import app, db
from models import *

migrate = Migrate(app, db)
manager = Manager(app)  # 创建Manager的实例
manager.add_command('db_migrate', migrate)
manager.add_command('db_upgrage', upgrade)


@manager.command
def hello():
    print('hello world')


manager.add_command('runserver', Server())  # 命令是runserver

if __name__ == '__main__':
    manager.run()
